import Vue from 'vue'
import App from './App.vue'
import router from './router'
// import './plugins/element.js'
import './assets/fonts/iconfont.css'
import './assets/css/global.css'
import ZkTable from 'vue-table-with-tree-grid'
import VueQuillEditor from 'vue-quill-editor'
import NProgress from 'nprogress'

// 配置axios
import axios from 'axios'

Vue.component('tree-table', ZkTable)
Vue.use(VueQuillEditor)
Vue.filter('dateFormat', function(val) {
    var dt = new Date(val)

    var y = dt.getFullYear()
    var m = (dt.getMonth() + 1 + '').padStart(2, 0)
    var d = (dt.getDate() + '').padStart(2, 0)

    var hh = (dt.getHours() + '').padStart(2, 0)
    var mm = (dt.getMinutes() + '').padStart(2, 0)
    var ss = (dt.getSeconds() + '').padStart(2, 0)

    return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
})
axios.defaults.baseURL = ' https://www.liulongbin.top:8888/api/private/v1/'
axios.interceptors.request.use(config => {
    NProgress.start()
    config.headers.Authorization = sessionStorage.getItem('token')
    return config
})
axios.interceptors.response.use(config => {
    NProgress.done()
    return config
})
Vue.prototype.$http = axios

Vue.config.productionTip = false

new Vue({
    router,
    render: h => h(App)
}).$mount('#app')